package com.st.chapter02;

import java.util.Random;
import java.util.Scanner;

import org.junit.Test;

public class Test3 {
	public static void main(String[] args) {
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print(i + "*" + j + "=" + (i * j) + "\t");
			}
			System.out.println();
		}

	}

	@Test
	public void test11() {
		// 生成一个随机数【1，100）+1
		int randomNumbrt = new Random().nextInt(100) + 1;
		System.out.println(randomNumbrt);
		Scanner scanner = new Scanner(System.in);
		// 死循环
		while (true) {
			System.out.println("猜吧");
			int num = scanner.nextInt();
			if (num > randomNumbrt) {
				System.out.println("太大了！");
			}
			if (num < randomNumbrt) {
				System.out.println("太小了！");
			}
			if (num == randomNumbrt) {
				System.out.println("对了！");
				break;
			}
			System.out.println("您是否要退出，输入0即可");
			int quit = scanner.nextInt();
			if (quit == 0) {
				break;
			}
		}
	}

	@Test
	public void test44() {
		int m = 0;
		for (int i = 1; i <= 100; i++) {
			if (i % 7 == 0) {
				m++;
				System.out.println(i);
			}
		}
		System.out.println(m);
	}

	@Test
	public void test66() {
		for (int i = 1; i <= 5; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}

	@Test
	public void test77() {
		int type = 3;
		switch (type) {
		case 1:
			System.out.println("1");
			break;
		case 2:
			System.out.println("2");
			break;
		case 3:
			System.out.println("3");
			break;
		default:
			System.out.println("default");
			break;

		}
	}

	@Test
	public void test88() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入年份");
		int year = scanner.nextInt();
		System.out.println("请输入月份");
		int mounth = scanner.nextInt();
		switch (mounth) {
		case 1:
			System.out.println("31天");
			break;
		case 2:
			if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
				System.out.println("29天");
			} else {

				System.out.println("28天");
			}
			break;
		case 3:
			System.out.println("31天");
			break;
		case 4:
			System.out.println("30天");
			break;
		case 5:
			System.out.println("31天");
			break;
		case 6:
			System.out.println("30天");
			break;
		case 7:
			System.out.println("31天");
			break;
		case 8:
			System.out.println("31天");
			break;
		case 9:
			System.out.println("30天");
			break;
		case 10:
			System.out.println("30天");
			break;
		case 11:
			System.out.println("30天");
			break;
		case 12:
			System.out.println("31天");
			break;

		default:
			System.out.println("输入错误");
			break;
		}
	}

	@Test
	public void test99() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入成绩");
		int score = scanner.nextInt();
		if(score < 0|| score > 100) {
			System.out.println("成绩不合法");
			return;
		}
		int num = score / 10;
		switch (num) {
		case 6:
			System.out.println("及格");
			break;
		case 7:
			System.out.println("一般");
			break;
		case 8:
			System.out.println("良好");
			break;
		case 9:
		case 10:
			System.out.println("优秀");
			break;

		default:
			System.out.println("不及格");
			break;
		}
	}
}
